﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Reflection;

namespace QXBook.Model
{
    public class ModelEnums
    {
        /// <summary>
        /// 获取枚举类子项描述信息
        /// </summary>
        /// <param name="enumSubitem">枚举类子项</param>        
        public static string GetEnumDescription(Enum enumSubitem)
        {
            string strValue = enumSubitem.ToString();

            FieldInfo fieldinfo = enumSubitem.GetType().GetField(strValue);
            Object[] objs = fieldinfo.GetCustomAttributes(typeof(DescriptionAttribute), false);
            if (objs == null || objs.Length == 0)
            {
                return strValue;
            }
            else
            {
                DescriptionAttribute da = (DescriptionAttribute)objs[0];
                return da.Description;
            }

        }
    }

    public enum AdminLoginStatus
    {
        Unknow = 0,
        /// <summary>
        /// 用户已经被锁定
        /// </summary>
        IsLock = 1,
        /// <summary>
        /// 用户名或密码错误
        /// </summary>
        UserOrPassError = 2,
        //[EnumAttribute("用户不存在")]
        /// <summary>
        /// 用户不存在
        /// </summary>
        Lost = 3,
        /// <summary>
        /// 已经登陆
        /// </summary>
        IsLogin = 4,
        OK = 5
    };

    public enum AdminError
    {
 
    }

    /// <summary>
    /// 管理删除的方式
    /// </summary>
    public enum AdminDeleteMod
    {
        Unknow = 0,
        Logic = 1,
        Physical = 2
    };

    public enum Module
    {
        Unknow = 0,
        Article = 1,
        Product = 2,
        Video = 3,
    };

    public enum VideoType
    { 
        Unknow = 0,
        /// <summary>
        /// 直播
        /// </summary>
        Live = 1,
        /// <summary>
        /// 电台
        /// </summary>
        Station = 2,
        /// <summary>
        /// 电视
        /// </summary>
        TV = 3,
    };

    [Flags]
    public enum Part
    {
        Unknow = 0,
        /// <summary>
        /// 今日秋霞圃
        /// </summary>
        [DescriptionAttribute("今日秋霞圃")]
        JRQXP = 2,
        /// <summary>
        /// 书院研习
        /// </summary>
        [DescriptionAttribute("书院研习")]
        SYYX = 4,
        /// <summary>
        /// 如是我闻
        /// </summary>
        [DescriptionAttribute("如是我闻")]
        RSWW = 8,
        /// <summary>
        /// 人文典藏
        /// </summary>
        [DescriptionAttribute("人文典藏")]
        RWDC = 16,
        /// <summary>
        /// 秋霞圃视听
        /// </summary>
        [DescriptionAttribute("秋霞圃视听")]
        QXPST = 32,
        /// <summary>
        /// 秋霞圃公益
        /// </summary>
        [DescriptionAttribute("秋霞圃公益")]
        QXPGY = 64,
        /// <summary>
        /// 书院概况
        /// </summary>
        [DescriptionAttribute("书院概况")]
        SYGK = 128,
        [DescriptionAttribute("资讯板块")]
        ZXFL = JRQXP | SYYX | RSWW | QXPGY | SYGK
    };
}
